/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = __t3_get_class_count.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2016/04/05 by jikw                                 */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include <t3/t3_core.h>
#include <t3/t3_analysis.h>
#include <t3/t3_ejb.h>
#include "frcomm.h"
#include "frmem.h"
#include "conntrack.h"
#include "frct_comm.h"
#include "../../../src/module/t3/config.h"
#include "../../../src/lib/report/frreport_dbg.h"

extern int __t3_get_class_count(Frbyte_Packet *p_st_data);
extern L7session_t3_private* __t3_private_create(void);

static int __suite_init(void)
{

	return 0;
}

static int __suite_cleanup(void)
{

	return 0;
}

static void case1(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    //测试修改部分
//    p_st_data = bytebuff_creat();
//    bytebuff_add(p_st_data,"\x28\x00", 2);

    i_ret = __t3_get_class_count(p_st_data);

    CU_ASSERT_EQUAL(i_ret, 0);

    return;
}

static void case2(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    //测试修改部分
    p_st_data = bytebuff_creat();
    bytebuff_add(p_st_data, (char *)"\x00\x00\x31\x32\x33", 5);

    i_ret = __t3_get_class_count(p_st_data);

    CU_ASSERT_EQUAL(i_ret, 0);

    bytebuff_free(&p_st_data);

    return;
}

static void case3(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    //测试修改部分
    p_st_data = bytebuff_creat();
    bytebuff_add(p_st_data, (char *)"\x00\x03\x78\x70\x77\x04", 6);

    i_ret = __t3_get_class_count(p_st_data);

    CU_ASSERT_EQUAL(i_ret, 4);

    bytebuff_free(&p_st_data);

    return;
}

int add_suite__t3_get_class_count(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __t3_get_class_count()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", case1) == NULL ||
        CU_add_test(pSuite, "case2", case2) == NULL ||
        CU_add_test(pSuite, "case3", case3) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
